<template>
  <Dialog v-model="visible" title="任务详情" width="520">
    <div v-if="tasks.length === 0" class="text-gray-500">暂无任务</div>
    <el-timeline v-else>
      <el-timeline-item v-for="t in tasks" :key="t.jobId">
        <div class="font-600 mb-6px">
          {{ t.jobName || '-' }}
          <el-tag size="small" class="ml-6px">{{ t.jobEnable || '-' }}</el-tag>
          <span class="text-12px text-gray-500 ml-8px">ID: {{ t.jobId }}</span>
        </div>
        <div class="mb-4px"><b>描述：</b>{{ t.jobRemark && t.jobRemark.length > 0 ? t.jobRemark : '-' }}</div>
        <div class="mb-8px"><b>状态：</b>{{ t.isCompleted ? '已完成' : '未完成' }}</div>
      </el-timeline-item>
    </el-timeline>
    <template #footer>
      <el-button @click="visible = false">关 闭</el-button>
    </template>
  </Dialog>
</template>
<script setup lang="ts">
defineOptions({ name: 'PmUserTasksDialog' })

const visible = ref(false)
const tasks = ref<any[]>([])

const open = (taskList: any[] = []) => {
  tasks.value = taskList || []
  visible.value = true
}
defineExpose({ open })
</script>


